package com.java.util.resp;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class EditorRespone {

	//0 be use success
	//if error so errno != 0
	private int errno;
	
	private Map<String,Object> data;

	public static EditorRespone error() {
		EditorRespone res = new EditorRespone();
		res.setErrno(-1);
		return res;
	}

	/*public static EditorRespone success(List<Map<String,Object>> data) {
		EditorRespone res = new EditorRespone();
		res.setErrno(0);
		res.setData(data);
		return res;
	}*/

	public static EditorRespone success(Map<String,Object> data) {
		//List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
		//datas.add(data);
		EditorRespone res = new EditorRespone();
		res.setErrno(0);
		res.setData(data);
		return res;
	}
	
	public static Map<String,Object> initMap(String url, String alt, String href){
		Map<String,Object> res = new HashMap<String, Object>();
		res.put("url", url);
		res.put("alt", alt);
		res.put("href", href);
		return res;
	}

	public int getErrno() {
		return errno;
	}

	public void setErrno(int errno) {
		this.errno = errno;
	}

	public Map<String,Object> getData() {
		return data;
	}

	public void setData(Map<String,Object> data) {
		this.data = data;
	}
	
}